home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / Vk / VkProgressDialog.z / VkProgressDialog
Encoding:
Text File  |  2002-10-03  |  10.0 KB  |  265 lines

  1.  
  2.  
  3.  
  4. VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                      VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      VkProgressDialog - A dialog manager supporting interruptible dialogs with
  10.      a progress indicator
  11.  
  12. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  13.      VkInterruptDialog : VkBusyDialog : VkDialogManager : VkComponent :
  14.      VkCallbackObject
  15.  
  16. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  17.      #include <Vk/VkProgressDialog.h>
  18.  
  19. PPPPUUUUBBBBLLLLIIIICCCC PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL SSSSUUUUMMMMMMMMAAAARRRRYYYY
  20.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr////DDDDeeeessssttttrrrruuuuccccttttoooorrrr
  21.            VkProgressDialog(const char* name, Boolean showCancel = TRUE);
  22.            virtual void ~VkProgressDialog(void);
  23.  
  24.  
  25.    CCCChhhhaaaannnnggggiiiinnnngggg PPPPeeeerrrrcccceeeennnntttt DDDDoooonnnneeee NNNNoooottttiiiiffffiiiiccccaaaattttiiiioooonnnn
  26.            Boolean setPercentDone(int);
  27.  
  28.  
  29. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  30.           This class supports applications that perform lengthy, interruptible
  31.           tasks, and wish to display progress to the user using a bar graph in
  32.           a dialog.
  33.  
  34.           VkProgressDialog is used in nearly the same manner as
  35.           VkInterruptDialog.  In addition to the features provided by
  36.           VkInterruptDialog, applications may call the _s_e_t_P_e_r_c_e_n_t_D_o_n_e() method
  37.           to change a graphical progress indicator in the dialog.
  38.  
  39.           By default, VkProgressDialog shows a "Cancel" button to the user to
  40.           permit interruptible tasks.  If you do not wish to allow users to
  41.           interrupt your task, you can prevent the "Cancel" button from
  42.           appearing by passing FALSE as the second parameter in the
  43.           VkProgressDialog constructor.
  44.  
  45.  
  46.  
  47. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  48.    VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg(((())))
  49.            VkProgressDialog(const char* name, Boolean showCancel = TRUE);
  50.  
  51.  
  52.           Initialize a VkProgressDialog object. Normally, applications can use
  53.           the globally instantiated _t_h_e_P_r_o_g_r_e_s_s_D_i_a_l_o_g.
  54.  
  55.           The _s_h_o_w_C_a_n_c_e_l parameter determines whether or not a "Cancel" button
  56.           is shown when the dialog is posted.  By default, the "Cancel" button
  57.           will appear.  If you pass FALSE as the value of _s_h_o_w_C_a_n_c_e_l, the
  58.           "Cancel" button will not appear.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                      VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  71.  
  72.  
  73.  
  74.           The "Cancel" button, if present, is handled in the same manner as
  75.           that for VkInterruptDialog.
  76.  
  77.    ~~~~VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg(((())))
  78.            virtual void ~VkProgressDialog(void);
  79.  
  80.  
  81.           Free the memory associated with a VkProgressDialog object.
  82.  
  83.    sssseeeettttPPPPeeeerrrrcccceeeennnnttttDDDDoooonnnneeee(((())))
  84.            void setPercentDone(int percentDone);
  85.  
  86.  
  87.           Change the dialog's graphical progress indicator.  The _p_e_r_c_e_n_t_D_o_n_e
  88.           parameter should be an integer between 0 and 100, where 100
  89.           represents a fully completed task.  inclusive.
  90.  
  91. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  92.           The following code segment installs the progress dialog, and
  93.           performs a simulated lengthy task, checking for interrupts
  94.           periodically and updating the progress indicator.
  95.  
  96.  
  97.            int i, j, k = 0;
  98.  
  99.             // Install the progress dialog as the
  100.             // dialog to post when busy
  101.  
  102.             theApplication->setBusyDialog(theProgressDialog);
  103.  
  104.             // Start being "busy"
  105.  
  106.             theApplication->busy("Very Busy",
  107.                                  (BusyWindow *) clientData);
  108.  
  109.             k = 0;
  110.             int percentDone = 0;
  111.  
  112.             for (i=0; i<10000; i++)
  113.             {
  114.                // Every so often, see if the task
  115.                // was interrupted
  116.  
  117.                   if(theProgressDialog->wasInterupted())
  118.                   {
  119.                       break;  // kick out of current
  120.                               // task if user interrupts
  121.                   }
  122.  
  123.                   // Update the percent done indicator.  Do this only if
  124.                   // we've made more than a one percent increment in progress.
  125.                   // This avoids updating the dialog more frequently than is
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                      VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  137.  
  138.  
  139.  
  140.                   // really necessary.
  141.  
  142.                   if ((i / 100) > percentDone)
  143.                   {
  144.                       percentDone = i / 100;
  145.                       theProgressDialog->setPercentDone(percentDone);
  146.                   }
  147.  
  148.                   sleep(1);
  149.               }
  150.  
  151.               // Task done, so we're not busy anymore
  152.  
  153.               theApplication->notBusy();
  154.  
  155.               // Restore the application's busy dialog
  156.               // as the default
  157.  
  158.               theApplication->setBusyDialog(NULL);
  159.  
  160.  
  161.  
  162. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  163.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg
  164.           wasInterrupted(), interruptedCallback
  165.  
  166.  
  167.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkDDDDiiiiaaaallllooooggggMMMMaaaannnnaaaaggggeeeerrrr
  168.           show(), hide(), className(), clearCache(), prepost(), ok(),
  169.           cancel(), apply(), setTitle(), setButtonLabels(), unpost(),
  170.           unpostAll(), centerOnScreen(), lastPosted(), post(), postModal(),
  171.           postBlocked(), postAndWait(), post(), _action, _showOK, _showCancel,
  172.           _showApply, _allowMultipleDialogs, _minimizeMultipleDialogs,
  173.           prepostCallback
  174.  
  175.  
  176.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCoooommmmppppoooonnnneeeennnntttt
  177.           installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
  178.           setDefaultResources(), getResources(), manage(), unmanage(),
  179.           baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback
  180.  
  181.  
  182.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCaaaallllllllbbbbaaaacccckkkkOOOObbbbjjjjeeeecccctttt
  183.           callCallbacks(), addCallback(), removeCallback(),
  184.           removeAllCallbacks()
  185.  
  186.  
  187. VVVVIIIIEEEEWWWWKKKKIIIITTTT 2222....1111 CCCCHHHHAAAANNNNGGGGEEEESSSS
  188.      In multi-screen enabled applications or components, references to
  189.      _t_h_e_P_r_o_g_r_e_s_s_D_i_a_l_o_g will only be valid for the _d_e_f_a_u_l_t screen in the
  190.      application.  The following new function API will return the
  191.      VkProgressDialog associated with the appropriate screen and should be
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                      VVVVkkkkPPPPrrrrooooggggrrrreeeessssssssDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  203.  
  204.  
  205.  
  206.      used instead of _t_h_e_P_r_o_g_r_e_s_s_D_i_a_l_o_g;
  207.  
  208.  
  209.            VkProgressDialog *getAppProgressDialog(VkComponent *comp);
  210.  
  211.  
  212. CCCCLLLLAAAASSSSSSSSEEEESSSS UUUUSSSSEEEEDDDD BBBBYYYY TTTTHHHHIIIISSSS CCCCLLLLAAAASSSSSSSS
  213.      VkApp
  214.  
  215. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  216.      VkInterruptDialog, VkBusyDialog, VkDialogManager, VkComponent, VkApp
  217.      _V_i_e_w_K_i_t _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
  218.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m, DEC Press, Bob Sheifler and Jim Gettys
  219.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m _T_o_o_l_k_i_t, DEC Press, Paul Asente and Ralph Swick
  220.      _T_h_e _O_S_F/_M_o_t_i_f _P_r_o_g_r_a_m_m_e_r_s _R_e_f_e_r_e_n_c_e, Prentice Hall, OSF
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.